package myjava.exceptions;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Root {

   static Scanner io = new Scanner(System.in); 
   
   private static int getInput()
      throws InputMismatchException {
      
      return Root.io.nextInt();           
   }
   
   public static void main(String[] args) {
           
      int divid = 5;
      int divis = 0;
      
      try {
         int x = divid / divis;
      } catch (ArithmeticException e) {
         System.out.println("Hai diviso per 0! MONA!");
      }
      
      System.out.println("Enter a number:"); 
      
      try {
         int n = Root.getInput();
         System.out.println("Well done! You entered the number " + n);
      } catch (InputMismatchException e) {
         System.out.println("You didn't enter a number! Shaaaaaame ...");         
      }  
   }
}
